/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kallsonys.object;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alladiab
 */
@Entity
@Cacheable(false)
@Table(name = "SUPPLIER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Supplier.findAll", query = "SELECT s FROM Supplier s"),
    @NamedQuery(name = "Supplier.findBySupplierid", query = "SELECT s FROM Supplier s WHERE s.supplierid = :supplierid"),
    @NamedQuery(name = "Supplier.findBySuppliername", query = "SELECT s FROM Supplier s WHERE s.suppliername = :suppliername")})
public class Supplier implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "SUPPLIERID")
    private BigDecimal supplierid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "SUPPLIERNAME")
    private String suppliername;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "supplierid")
    private List<Orderquote> orderquoteList;

    public Supplier() {
    }

    public Supplier(BigDecimal supplierid) {
        this.supplierid = supplierid;
    }

    public Supplier(BigDecimal supplierid, String suppliername) {
        this.supplierid = supplierid;
        this.suppliername = suppliername;
    }

    public BigDecimal getSupplierid() {
        return supplierid;
    }

    public void setSupplierid(BigDecimal supplierid) {
        this.supplierid = supplierid;
    }

    public String getSuppliername() {
        return suppliername;
    }

    public void setSuppliername(String suppliername) {
        this.suppliername = suppliername;
    }

    @XmlTransient
    public List<Orderquote> getOrderquoteList() {
        return orderquoteList;
    }

    public void setOrderquoteList(List<Orderquote> orderquoteList) {
        this.orderquoteList = orderquoteList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (supplierid != null ? supplierid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Supplier)) {
            return false;
        }
        Supplier other = (Supplier) object;
        if ((this.supplierid == null && other.supplierid != null) || (this.supplierid != null && !this.supplierid.equals(other.supplierid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.kallsonys.object.Supplier[ supplierid=" + supplierid + " ]";
    }
    
}
